# Build recipe for iana-etc.
#
# Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

program=iana-etc
version=2.30
arch=noarch
release=1

# Set 'outdir' for a nice and well-organized output directory
outdir="${outdir}/${arch}/data"

tarname=${program}-${version}.tar.bz2

# Remote source(s)
fetch=http://sethwklein.net/$tarname

description="
Provides /etc/services and /etc/protocols files.

The iana-etc package provides the Unix/Linux /etc/services and
/etc/protocols files.  Using data from the Internet Assigned
Numbers Authority <http://www.iana.org>.
"

homepage=http://www.iana.org/protocols
license=OSLv3.0

# Source documentation
docs="COPYING CREDITS NEWS README VERSION"
docsdir="${docdir}/${program}-${version}"

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    # Set sane permissions
    chmod -R u+w,go-w,a+rX-s .

    make all && make DESTDIR="$destdir" install

    # To handle config file(s)
    touch "${destdir}/etc/.graft-config"

    # Copy documentation
    mkdir -p "${destdir}${docsdir}"

    for file in $docs
    do
        cp -p $file "${destdir}${docsdir}"
    done
}

